
clear all
use data/judgeyear.dta

drop if year < 1974

gen contested = howretain == "P" | howretain == "NP"
gen uncontested = howretain == "U" | howretain == "T"

foreach y in numops numdisc numwords numwords_maj_m numtoc_maj_m poscites_m distcites_m negcites_m outstatecites_m discusscites_m quotecites_m {
gen log`y' = log(1+`y')
eststo: quietly reg log`y' i.year 			i.uncontested#c.logsal i.uncontested#c.mandeither#c.logsal , 		 vce(cluster stateabb)
eststo: quietly areg log`y' i.year i.statefe#c.year 	i.uncontested#c.logsal i.uncontested#c.mandeither#c.logsal , absorb(statefe) vce(cluster stateabb)
eststo: quietly areg log`y' i.year i.statefe#c.year 	i.uncontested#c.logsal i.uncontested#c.mandeither#c.logsal , absorb(judgefe) vce(cluster stateabb)
}

esttab using tables/salary-3-retain.csv, nogaps replace ar2 se drop(_cons *year ) star(+ 0.10 * 0.05 ** 0.01)
